﻿using System.Collections;
using System.Collections.Generic;
using Robotlegs.Bender.Platforms.Unity.Extensions.Mediation.Impl;
using Robotlegs.Bender.Extensions.EventManagement.Impl;
using UnityEngine.UI;

public class MyTextView : EventView
{
	protected override void Start()
	{
		base.Start();

		dispatcher.Dispatch(new ViewEvent(ViewEvent.Type.REQUEST));

		this.GetComponent<Button>().onClick.AddListener(OnBtnClicked);
	}

	public void UpdateScore(int score)
	{
		this.GetComponent<Text>().text = score.ToString();
	}

	private void OnBtnClicked()
	{
		//View派发器
		dispatcher.Dispatch(new ViewEvent(ViewEvent.Type.ADD));
	}
}
